﻿
/**
 * @author Msun
 */

class lite.mobile.lib.key.Keyboard {
	public static var KEY_LEFT : Number = 10;
	public static var KEY_UP : Number = 11;
	public static var KEY_RIGHT : Number = 12;
	public static var KEY_DOWN : Number = 13;
	public static var KEY_OK : Number = 15;
	public static var KEY_1 : Number = 1;
	public static var KEY_2 : Number = 2;
	public static var KEY_3 : Number = 3;
	public static var KEY_4 : Number = 4;
	public static var KEY_5 : Number = 5;
	public static var KEY_6 : Number = 6;
	public static var KEY_7 : Number = 7;
	public static var KEY_8 : Number = 8;
	public static var KEY_9 : Number = 9;
	public static var KEY_0 : Number = 0;
	public static var KEY_STAR : Number = 20;
	public static var KEY_SHARP : Number = 21;
	public static var KEY_SOFT2 : Number = 30;

	public static function getKeyCode() : Number {
		var code = Key.getCode();
		var ascii : Number = Key.getAscii();
		if (code == "soft2") {
			return KEY_SOFT2;
		}else if (ascii >= 48 && ascii <= 57) {
			//数字
			return ascii - 48;
		} else if (ascii == 42) {
			return KEY_STAR;
		} else if (ascii == 35) {
			return KEY_SHARP;
		} else if (code >= 37 && code <= 40) {
			//左上右下
			return code - 37 + 10;
		} else if (code == 13 && ascii == 13) {
			return KEY_OK;
		}
	}
}
